﻿Imports BUS
Imports DTO

Public Class frmxlcapnhatbophan

    Private _maBoPhan As Integer
    Public Property MaBoPhan() As Integer
        Get
            Return _maBoPhan
        End Get
        Set(ByVal value As Integer)
            _maBoPhan = value
        End Set
    End Property
    Private _tenBoPhan As String
    Public Property TenBoPhan() As String
        Get
            Return _tenBoPhan
        End Get
        Set(ByVal value As String)
            _tenBoPhan = value
        End Set
    End Property
    Private Sub frmxlcapnhatbophan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btnchapnhan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnchapnhan.Click
        If txttenbophan.Text <> "" Then
            Dim sql As String = "Update BOPHAN Set TenBoPhan=" + "'" + txttenbophan.Text + "'" + " Where MaBoPhan=" + _maBoPhan.ToString()
            Dim bus As New BoPhanBUS()
            Dim kq As Integer = bus.CapNhatBoPhan(sql)
            If kq = 1 Then
                MessageBox.Show("Câp nhật thành công !")
                Me.Close()
            Else
                MessageBox.Show("Cập nhật thất bại !")
            End If
        Else
            MessageBox.Show("Nhập tên bộ phận !")
        End If
    End Sub

    Private Sub btnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthoat.Click
        Me.Close()
    End Sub
End Class